<?php
include("../com.inc.php");
//error_reporting('E-ALL');
if(!$_SESSION['memberID']){exit("<script>window.location='dlogin.html'</script>");}
	$ac=$GLOBALS['_ac'];
	$pw=$GLOBALS['_pw'];
	$s = new SoapClient(null,array("location" => "http://localhost/open/openService/pft_insideMX.php","uri" => "www.16u.com?ac_16u=$ac|pw_16u=$pw|auth_16u=true"));
	$sel="select dname,account from pft_member where id=".$_SESSION['memberID'];
	$GLOBALS['le']->query($sel);
	$GLOBALS['le']->fetch_assoc();
	$account=$GLOBALS['le']->f("account");
	$oname=$GLOBALS['le']->f("dname");
	//echo $account."<br/>".$oname;
	$res=$s->Create_Conn_REC($account, $oname);
	$res_date = simplexml_load_string($res);
	if(strlen($res)==32)
	{
		$goodsname = $account.$oname.$res_date;
		jiekou_pw('------------------记录商家的接口账号密码---------------------','/abc/jiekou_pw.txt');
		jiekou_pw($goodsname,'abc/jiekou_pw.txt');
		echo "<script>alert('关联成功!');window.location.href='soap.html'</script>";
		exit;
		}
    else
	{
		echo "<script>alert('账号id出错!错误码:".$res."');</script>";
	}
	
function jiekou_pw($txt,$path){
	$fp = fopen($path,"a");
	flock($fp, LOCK_EX) ;
	fwrite($fp,$txt."\n");
	flock($fp, LOCK_UN);
	fclose($fp);
}
 
?>